package com.atguigu.lease.web.admin.service.impl;

import com.atguigu.lease.web.admin.dto.AppointmentSearchDto;
import com.atguigu.lease.web.admin.mapper.ViewAppointmentMapper;
import com.atguigu.lease.web.admin.vo.AppointmentInfoVo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.atguigu.lease.model.entity.ViewAppointment;
import com.atguigu.lease.web.admin.service.ViewAppointmentService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 1
* @description 针对表【view_appointment(预约看房信息表)】的数据库操作Service实现
* @createDate 2024-08-28 11:00:26
*/
@Service
public class ViewAppointmentServiceImpl extends ServiceImpl<ViewAppointmentMapper, ViewAppointment>
    implements ViewAppointmentService{

    @Override
    public Page<AppointmentInfoVo> pageItem(AppointmentSearchDto searchDto) {
        //1、自定义sql联查
        Page<AppointmentInfoVo> page = searchDto.getPage(AppointmentInfoVo.class);
//        LambdaQueryWrapper<ViewAppointment> lambdaQuery = Wrappers.lambdaQuery(ViewAppointment.class);
//        String name = searchDto.getName();
//        String phone = searchDto.getPhone();
//        Long apartmentId = searchDto.getApartmentId();
//        Long provinceId = searchDto.getProvinceId();
//        Long cityId = searchDto.getCityId();
//        Long districtId = searchDto.getDistrictId();
        List<AppointmentInfoVo> appointmentInfoVos = baseMapper.selectPageItem(page,searchDto);

        page.setRecords(appointmentInfoVos);
        return page;
    }
}




